﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;

namespace Three_Red_Dragon_Mvc.Controllers
{

    /// <summary>
    /// 权限管理控制器
    /// </summary>
    public class PermissionController : Controller
    {
        private readonly IpAddressesConfig _ipAddressesConfig;

        public PermissionController(IOptions<IpAddressesConfig> ipAddressesConfig)
        {
            _ipAddressesConfig = ipAddressesConfig.Value;
        }
        /// <summary>
        /// 权限添加
        /// </summary>
        /// <returns></returns>
        public IActionResult AddPermission()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }

        /// <summary>
        /// 权限列表
        /// </summary>
        /// <returns></returns>
        public IActionResult QueryPermission()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            ViewBag.MVCIp = _ipAddressesConfig.MVCIp;
            return View();
        }

        /// <summary>
        /// 用户角色添加
        /// </summary>
        /// <returns></returns>
        public IActionResult AddUserRoles()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }

        /// <summary>
        /// 角色权限添加
        /// </summary>
        /// <returns></returns>
        public IActionResult AddRolePermission()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }

        /// <summary>
        /// 权限修改
        /// </summary>
        /// <returns></returns>
        public IActionResult UpdatePermission()
        {
            ViewBag.RBACWrite = _ipAddressesConfig.RBACWrite;
            ViewBag.RedDragonWrite = _ipAddressesConfig.RedDragonWrite;
            return View();
        }
    }
}
